import { defineStore } from 'pinia'
const useGlobalStore = defineStore('global', {
  state: () => {
    return {
      token: '',
      userInfo: '',
      language: 'zh',
      assemblySize: 'default',
      themeConfig: {
        // 折叠菜单
        isCollapse: false,
      },
    }
  },
  actions: {
    setLanguage(language) {
      this.language = language
    },
    setToken(token: string) {
      this.token = token
    },
    // setUserInfo
    setUserInfo(userInfo: any) {
      this.userInfo = userInfo
    },
    setThemeConfig(themeConfig) {
      this.themeConfig = themeConfig
    },
  },
  persist: true,
})

export default useGlobalStore
